package com.sys.app.service.Impl.sys;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sys.app.entity.sys.SysAccount;
import com.sys.app.mapper.sys.SysAccountMapper;
import com.sys.app.service.sys.ISysAccountService;
import org.springframework.stereotype.Service;

@Service
public class SysAccountServiceImpl extends ServiceImpl<SysAccountMapper, SysAccount> implements ISysAccountService {
    private SysAccountMapper sysAccountMapper;

    public SysAccountServiceImpl(SysAccountMapper sysAccountMapper){
        this.sysAccountMapper=sysAccountMapper;
    }
    /**
     * 登录获取密钥
     * @param user
     * @return
     */
    @Override
    public SysAccount authentication(SysAccount user) {
        QueryWrapper<SysAccount> queryWrapper=new  QueryWrapper<SysAccount>();
        queryWrapper.eq("USER_CODE",user.getCode());
        queryWrapper.eq("PASSWORD",user.getPassword());
        queryWrapper.eq("STATUS",0);
        return sysAccountMapper.selectOne(queryWrapper);
    }
}
